package com.navajo.web.business.view.navigation;

import java.util.Date;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;

import com.google.common.eventbus.EventBus;
import com.navajo.web.business.page.SideBarMenu;
import com.navajo.web.core.Events;
import com.navajo.web.core.ScopeVaadin;
import com.vaadin.event.FieldEvents.TextChangeEvent;
import com.vaadin.event.FieldEvents.TextChangeListener;
import com.vaadin.server.ExternalResource;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Button.ClickListener;
import com.vaadin.ui.Link;
import com.vaadin.ui.MenuBar.Command;
import com.vaadin.ui.MenuBar.MenuItem;
import com.vaadin.ui.NativeButton;
import com.vaadin.ui.TextField;
import com.vaadin.ui.VerticalLayout;


public class NavigationView extends VerticalLayout implements ClickListener,Command {


    
    @Autowired
    ApplicationContext applicationContext;
    
    public NavigationView() {

    }






    @Override
    public void buttonClick(ClickEvent event) {
        
        System.out.println("NavigationView.buttonClick()");
        applicationContext.getBean(SideBarMenu.class).test();
        
        
//        if (event.getButton() == buttonSearch) {
//            System.out.println("NavigationView.buttonClick()");
//            NavigationViewEvent navigationEvent = new NavigationViewEvent(Events.SingleSearchEvent, this, new Date());
//            eventBus.post(navigationEvent);
//        }
//        if (event.getButton() == buttonFileSearch) {
//            NavigationViewEvent navigationEvent = new NavigationViewEvent(Events.FileSearchEvent, this, new Date());
//            eventBus.post(navigationEvent);
//        }
    }



    @Autowired
    public void generate() {
        
        NativeButton button=new NativeButton("Navigation",this);
        
        
        Link link1=new Link("Hallo",new ExternalResource("#"));
        
        
        
        
        addComponent(button);
        addComponent(link1);
    }



    @Override
    public void menuSelected(MenuItem selectedItem) {

        
        
    }
}
